<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %>

<div class="admin-table">
    <table>
        <thead>
        <tr>
            <th>ID</th>
            <th>发生时间</th>
            <th>事件内容</th>
            <th>图片</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${timeline}" var="timeline">
            <tr>
                <td>${timeline.id}</td>
                <td>${timeline.eventDate}</td>
                <td style="max-width: 350px">${timeline.content}</td>
                <td class="timeline-images">
                    <c:if test="${not empty timeline.images}">
                        <c:forEach items="${timeline.images.split(',')}" var="image">
                            <img onclick="window.location.href='${image}'" src="${image}" alt="记录图片">
                        </c:forEach>
                    </c:if>

                </td>
                <td>
                    <fmt:formatDate value="${timeline.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td>
                    <button type="button" class="btn-small btn-danger" onclick="deleteTimeline('${timeline.id}')">删除</button>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<script src="/static/js/admin-timeline.js"></script>